package com.davy.gridpoint.view;

import android.os.CountDownTimer;

import com.davy.gridpoint.DavyApp;
import com.davy.gridpoint.interdaces.TimeCallback;
import com.davy.gridpoint.utils.SPUtils;
import com.davy.gridpoint.utils.StringUtils;


public class MyCountDownTimer extends CountDownTimer {

    private TimeCallback timeCallback;

    public void setTimeCallback(TimeCallback timeCallback) {
        this.timeCallback = timeCallback;
    }

    public MyCountDownTimer(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
    }

    @Override
    public void onTick(long millisUntilFinished) {
    }

    @Override
    public void onFinish() {
        try {
            if (timeCallback != null) {
                timeCallback.onFinish();
            }
        } catch (Exception e) {
            SPUtils.put(DavyApp.getContext(), "benE", e.toString());
            SPUtils.put(DavyApp.getContext(), "benS", StringUtils.getTimeS());
        }
    }
}
